#pragma once

#include <vex/core/as_intrusive.h>
#include <vex/iterable/make_raw_range.h>

namespace vex { namespace iterable {
    // Creates a instance of a iterable contract using solely the information encoded in TRange.
    // Returns a intrusive pointer to the instance of the deduced contract type
    template <class TRange>
    auto make_intrusive_range(TRange && p_range) 
        -> decltype(as_intrusive_from_out(make_raw_range(std::forward<TRange>(p_range))))
        //boost::intrusive_ptr< implementation::range_default_impl<TRange> >
        //boost::intrusive_ptr< contract::range<
        //    typename range_traits<TRange>::category,
        //    typename range_traits<TRange>::reference
        //   > >
    {
        return as_intrusive_from_out(make_raw_range(std::forward<TRange>(p_range)));
    }
}}